package com.vhall.component.framework.oss.client.impl.qcloud;


import com.vhall.component.framework.common.exception.ErrorCode;
import com.vhall.component.framework.common.exception.GlobalErrorCode;
import com.vhall.component.framework.oss.client.OssCodeMapping;
import com.vhall.component.framework.oss.client.OssErrorCode;

/**
 * https://cloud.tencent.com/document/product/436/7730
 *
 * @author yongzheng.xu
 * @date 2021/5/22 21:50
 */
public class QCloudCodeMapping implements OssCodeMapping {


    @Override
    public ErrorCode apply(String s) {
        switch (s) {
            case "OK":
                return GlobalErrorCode.SUCCESS;
            case "MissingAccessKeyId":
                return OssErrorCode.EXCEPTION;
            case "SignatureDoesNotMatch":
                return OssErrorCode.SIGN_ERROR;
            default:
                return OssErrorCode.UNKNOWN;
        }
    }
}
